package jm.demo.je;

import java.io.Serializable;
import java.util.Random;

public class SupplierData implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -2983255078970590381L;
    
    private String name;
    private int status;
    private String city;
    
    

    public SupplierData() {
        super();
    }

    public SupplierData(String name, int status, String city) {

        this.name = name;
        this.status = status;
        this.city = city;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String toString() {

        return "[SupplierData: name=" + name +
            " status=" + status +
            " city=" + city + ']';
    }
    
    
    
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((city == null) ? 0 : city.hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        result = prime * result + status;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        SupplierData other = (SupplierData) obj;
        if (city == null) {
            if (other.city != null)
                return false;
        } else if (!city.equals(other.city))
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        if (status != other.status)
            return false;
        return true;
    }

    public static SupplierData createRandom(Random r) {
        SupplierData result = new SupplierData();

        result.setName("name-" + r.nextInt());
        result.setStatus(r.nextInt());
        result.setCity("city-" + r.nextInt());

        return result;
    }

}
